package com.km.team.phsystem.web.controller;

import com.km.team.phsystem.beans.pojo.SystemDate;
import com.km.team.phsystem.beans.vo.ResponseData;
import com.km.team.phsystem.web.controller.base.BaseController;
import com.km.team.phsystem.web.utils.ResponseDataUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author ：bastr.
 * @description：设置节假日信息
 * @date ：2018/10/20
 */
@RestController
@RequestMapping("/date")
public class SysDateController extends BaseController<SysDateController> {

    @ApiOperation(value = "获取一个月的详细信息", notes = "")
    @GetMapping("month")
    public ResponseData selectDateForMonth(String month) {
        logger.info(month);
        List<SystemDate> systemDateList = dateService.selectDateForMonth(month);
        return ResponseDataUtil.buildSuccess(systemDateList);
    }
    @ApiOperation(value = "保存一个月的节假日设置数据", notes = "")
    @PostMapping("holiday")
    public ResponseData selectDateForMonth(@RequestBody List<Map<String, String>> holidayList) {
        logger.info(holidayList.toString());
        int i = dateService.insterHoliday(holidayList);
        return ResponseDataUtil.buildSuccess(i);
    }
    @ApiOperation(value = "获取业务ID下，31天的非节假日排号情况", notes = "")
    @GetMapping("queue/status/{businessId}")
    public ResponseData selectQueueDateStatus(@PathVariable("businessId") Integer businessId) {
        return ResponseDataUtil.buildSuccess(dateService.selectQueueDateStatus(businessId));
    }
}
